// theme.js
import {Theme} from 'theme-model.js'
var theme = new Theme

Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var id = options.id;
    var name = options.name;

    this.data.id = id;
    this.data.name = name;

    wx.setNavigationBarTitle({
      title: name,
    });

    this._loadData()
  },

  onReady: function() {
    // wx.setNavigationBarTitle({
    //   title: '测试二',
    // });
  },

  _loadData : function() {
    theme.getThemeInfo(this.data.id, (data) => {
      this.setData({
        "themeInfo" : data
      });
    })
  },

  onProductsItemTap : function(event) {
    var id = theme.getDataset(event, 'id');
    wx.navigateTo({
      url: '../product/product?id=' + id
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

})